package account.view;

import java.util.HashMap;

public class ViewHelper {

	public static final Integer VIEW_MENU = 0;
	public static final Integer VIEW_LEFT = 1;
	public static final Integer VIEW_CONTENT = 2;
	public static final Integer VIEW_RIGHT = 3;
	
	public static final String DEFAULT = "default";
	public static final String DRL = "drl";
	public static final String NEWACCOUNT = "newaccount";
	
	private HashMap<String, String[]> views = new HashMap<String, String[]>();
	private String currMenuPos = "";

	public ViewHelper() {											  
		String[] defaultLayold = new String[]{"/menu.xhtml","/listaccount.xhtml","/accountinfo.xhtml",""};
		currMenuPos = ViewHelper.DEFAULT;
		views.put(currMenuPos, defaultLayold);	

		String[] drlLayold = new String[]{"/menu.xhtml","","/drledit.xhtml",""};
		views.put(ViewHelper.DRL, drlLayold);
		

		String[] newAccount = new String[]{"/menu.xhtml","/listaccount.xhtml","/addaccount.xhtml",""};
		views.put(ViewHelper.NEWACCOUNT, newAccount);	
	}
	
	public void register2( String menu, String left, String content)
	{
		views.put(menu, new String[]{menu, left, content});
	}

	public String[] getViewLayold() {
		//System.out.println("0: " + views.get(currMenuPos)[0] + "1: " + views.get(currMenuPos)[1] + "2: " + views.get(currMenuPos)[2]);
		return views.get(currMenuPos);
	}
	
	public String[] getViewLayold( String menu) {
		currMenuPos = menu;
		return getViewLayold();
	}

	public String getCurrMenuPos() {
		return currMenuPos;
	}

	public void setCurrMenuPos(String currMenuPos) {
		if( !views.containsKey( currMenuPos ) ) return;
		this.currMenuPos = currMenuPos;
	}
		
}
